<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('blog_articles', function (Blueprint $table) {
            $table->id()->comment('编号');
            $table->integer('category_id')->comment('分类ID');
            $table->integer('author_id')->comment('作者ID');
            $table->string('title')->comment('标题');
            $table->string('description', 1000)->comment('描述');
            $table->longText('content')->comment('内容');
            $table->integer('comment_quantity')
                ->unsigned()
                ->default(0)
                ->comment('评论数量');
            $table->integer('reading_quantity')
                ->unsigned()
                ->default(0)
                ->comment('阅读数量');
            $table->integer('like_quantity')
                ->unsigned()
                ->default(0)
                ->comment('点赞数量');
            $table->tinyInteger('status')
                ->unsigned()
                ->default(1)
                ->comment('状态:0=隐藏,1=显示');
            $table->timestamps();
            $table->softDeletes();
            $table->comment('【博客】文章表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('blog_articles');
    }
};
